﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Web;

using ProjectBase.Core;
using ProjectBase.Core.Storage;

namespace $safeprojectname$.Providers
{
    /// <summary>
    ///     Profile based provider for ISessionStorage - httpcontext.profile
    /// </summary>
    public class ProfileSessionStorageProvider : DefaultSessionStorageProvider
    {
        public override ISessionStorage GetSessionStorage(HttpContextBase context)
        {
            if (context.Is() && context.Profile.Is())
            {
                return new ProfileSessionStorage(context.Profile);
            }
            return base.GetSessionStorage(context);
        }
        public override ISessionStorage GetSessionStorage(HttpContext context)
        {
            if (context.Is() && context.Profile.Is())
            {
                return new ProfileSessionStorage(context.Profile);
            }
            return base.GetSessionStorage(context);
        }
        public override ISessionStorage GetSessionStorage()
        {
            var context = HttpContext.Current;
            if (context.Is() && context.Profile.Is())
            {
                return new ProfileSessionStorage(context.Profile);
            }
            return base.GetSessionStorage();
        }

        public override void Shutdown() { }
    }
}